<?php
class masterkey_ctl_admin_repairconfig extends desktop_controller
{

    /*
    *  补货配置
    */
    public function index()
    {
        //仓库数据
        $brObj = app::get('ome')->model('branch');
        $row = $brObj->getList('branch_id, name',array('b_type'=>1),0,-1);
        if($_POST)
        {
            $branch_id = $_POST['branch_id'];
            $result = app::get('ome')->setConf('repair.config',$branch_id);
            if(!$result) $this->splash('error',"index.php?app=masterkey&ctl=admin_repairconfig&act=index","配置失败",'redirect',array());
            $msg="配置成功";
            $this->splash('success',"index.php?app=masterkey&ctl=admin_repairconfig&act=index",$msg,'redirect',array());
        }
        //读取缓存
        $data = app::get('ome')->getConf('repair.config');
        $this->pagedata['data']  = $data;
        $this->pagedata['branch']= $row;
        $this->page('admin/repairconfig.html');
    }
}
